package com.yukino.pojo.serviceResult;

import com.yukino.pojo.Project;
import com.yukino.pojo.User;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Data
@NoArgsConstructor
public class ProjectInfo {
    private Long project_id;
    private String project_name;
    private Long dept_id;
    private String leader;
    private String level;
    private Integer funds;
    private String profiles;
    private String dept_name;
    private List<String> users;

    public ProjectInfo(Project p) {
        this.project_id = p.getProject_id();
        this.project_name = p.getProject_name();
        this.leader = p.getLeader();
        this.level = p.getLevel();
        this.funds = p.getFunds();
        this.profiles = p.getProfiles();
        this.dept_id = p.getDept_id();

        this.users=new ArrayList<>();
        for (User user : p.getUsers()) {
            this.users.add(user.getName());
        }

        Collections.reverse(this.users);
    }
}
